#ifndef SERVERFORM_H
#define SERVERFORM_H

#include <QWidget>
#include <QTcpServer>
#include <QTcpSocket>
#include "thread.h"
#include <QSqlDatabase>
#include <QSqlQueryModel>

namespace Ui {
class ServerForm;
}

class ServerForm : public QWidget
{
    Q_OBJECT

public:
    explicit ServerForm(QWidget *parent = 0, QSqlDatabase *db = 0);
    ~ServerForm();
    void doWork(QString ip);
private slots:
    void on_startPushButton_clicked();
    void readMessage();
    void newConnect();

    void on_closePushButton_clicked();

    void on_stopPushButton_clicked();

private:
    Ui::ServerForm *ui;
    QTcpServer tcpServer;
    QTcpSocket *tcpSocket;
    Thread thread;
    QSqlDatabase db;
    QSqlQueryModel *model;
     enum {WANDA_MODEL, LEONIS_MODEL, SERVER_MODEL};
};

#endif // SERVERFORM_H
